<template>
    <div class="top">
        <button @click="Cilck">新增任务</button>
        <div class="task">
            <p>全部任务({{$store.tasklist.length}})</p>
            <p>已完成({{$store.tasklist.length - $store.num}})</p>
            <p>未完成({{$store.num}})</p>
        </div>
    </div>
    <router-view></router-view>
</template>

<script setup>
    import { useRouter }  from 'vue-router'
    import {useCounterStore} from '../stores/index'    

    let $router = useRouter()
    let $store = useCounterStore()


    let Cilck = ()=>{
        $router.push('/add')
    }
    

</script>

<style scoped>
    .top button{
        width: 120px;
        height: 40px;
        background-color: rgb(22, 147, 209);
        border: none;
        outline: none;
        font-weight: 700;
        font-size: 18px;
        color: white;
        margin-bottom: 20px;
        border-radius: 10px;
    }
    .top .task{
        display: flex;
        justify-content: space-around;
        align-items: center;
        width: 100%;
    }
    .top .task p{
        width: 200px;
        height: 30px;
        text-align: center;
        line-height: 30px;
        margin-right: 20px;
        background-color: lightskyblue;
        border-radius: 10px;
    }
    .top .task p:nth-child(3){
        background-color: red;
    }
</style>